package com.rpc.test;

import com.DemoApplication;
import com.rpc.server.HelloService;
import com.rpc.util.RpcProxy;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @Auther: zwg
 * @Date: 2019/1/7 11:14
 * @Description:
 */
@SpringBootTest(classes = DemoApplication.class)
@RunWith(SpringRunner.class)
public class HelloClient {

    @Resource(name = "rpcProxy")
    private RpcProxy rpcProxy;

    @Test
    public void test() throws Exception {

        HelloService helloService = rpcProxy.create(HelloService.class);
        String result = helloService.hello("World");
        System.out.println(result);

        HelloService helloService2 = rpcProxy.create(HelloService.class, "sample.hello2");
        String result2 = helloService2.hello("世界");
        System.out.println(result2);

        System.exit(0);
    }
}
